//
//  SearchResultViewController.swift
//  clreader
//
//  Created by colin on 2019/4/2.
//  Copyright © 2019 colin. All rights reserved.
//

import UIKit

/// 搜索结果页
class SearchResultViewController: CLBaseViewController {

    private var tabs = ["电子书", "其他"]
    private lazy var contentScrollView = UIScrollView(frame: CGRect.zero)
    private var resultTableViews = [Int:UITableView]()
    
    /// 搜索关键字
    var keyword = "" {
        didSet {
            if oldValue != self.keyword {
                // 刷新结果
                
            }
        }
    }
    
    convenience init(keyword:String) {
        self.init()
        self.keyword = keyword
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        
        let segmentedView = CLSegmentedView(segments: self.tabs)
        self.view.addSubview(segmentedView)
        segmentedView.snp.makeConstraints { (make) in
            make.left.right.top.equalToSuperview()
            make.height.equalTo(44.0)
        }
        
        self.contentScrollView.do {
            $0.contentInsetAdjustmentBehavior = .never
        }
        self.view.addSubview(self.contentScrollView)
        self.contentScrollView.snp.makeConstraints { (make) in
            make.left.right.bottom.equalToSuperview()
            make.top.equalTo(segmentedView.snp.bottom)
        }
        
    }

}
